import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Registe from '@/views/Registe'
import Home from '@/views/Home'
import Profile from '@/views/Profile'
import List from '@/views/List'
import News from '@/views/News'
import Layout from '@/views/Layout'
import City from '@/views/City'
import Map from '@/components/Map'
import Detail from '@/views/Detail'
import Rent from '@/views/Rent'
import Lists from '@/views/Rent/list.vue'
import Add from '@/views/Rent/add.vue'
import Search from '@/views/Rent/search.vue'
import Favorate from '@/views/Favorate'
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: Login
  },
  {
    path: '/map',
    component: Map
  },
  {
    path: '/registe',
    component: Registe
  },
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Layout,
    children: [
      { path: '/', component: Home, name: 'home' },
      { path: 'profile', component: Profile },
      { path: 'list', component: List, name: 'list' },
      { path: 'news', component: News }
    ]
  },
  {
    path: '/city',
    component: City
  },
  {
    path: '/detail/:keyword',
    component: Detail
  },
  {
    path: '/rent',
    component: Rent,
    children: [
      { path: '', component: Lists },
      { path: 'add', component: Add, name: 'Add' },
      { path: 'search', component: Search }
    ]
  },
  {
    path: '/favorate',
    component: Favorate
  }
]

const router = new VueRouter({
  routes
})

export default router
